package org.wlw.ex;

public class TestException03 {
	public static void main(String[] args) {
		try {
			int a = 10;
			int b = 0;
			int n = a/b;
			System.out.println("关闭文件");
		} catch(ArithmeticException e) {
			System.err.println(e.getMessage());
		} finally {
			//finally中的代码不论什么情况都会执行
			System.out.println("关闭文件");
		}
		//finally必须和try在一起，可以不要catch
		
		try {
			System.out.println("打开文件");
			System.out.println("读取文件");
			String s = null;
			s.indexOf(0);
		} finally {
			System.out.println("释放内存");
		}
	}
}
